package wrice.esm.compiler;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class ExplicitStateMachineCompiler {

	public static void main(String[] args) {
		if( args.length < 2 )
			throw new RuntimeException("StateMachineDefinition filename or output folder basename is not found.");
		
		ExplicitStateMachineCompiler compiler = new ExplicitStateMachineCompiler();
		compiler.compile( args[0], args[1] );
	}

	public void compile(String inputFilename, String outputFolder) {
		File file = new File( inputFilename );
		Scanner stateMachineDefinition;
		try {
			stateMachineDefinition = new Scanner( file );
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			throw new RuntimeException( "File not found: " + inputFilename );
		}

		Parser parser = new Parser( stateMachineDefinition );
		stateMachineDefinition.close();

		//Generator generator = 
			new JavaGenerator( parser, outputFolder );
	}
	

}
